package com.kerbores.wzcc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.kerbores.framworks.BaseActivity;

/**
 * 结果详细
 * @author wangzhengfu
 *
 */
public class ResultDetailActivity extends BaseActivity {
	
	private ListView listView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		//设置主题颜色
		getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
		
		setContentView(R.layout.activity_result_detail);
		
		listView = (ListView)findViewById(R.id.listView);
		
		//接收传递数据
		Map<String,String> map = (Map<String,String>)getIntent().getSerializableExtra("imap");
		
		//拼装适配器需要的格式数据
		List<Map<String,String>> list = new ArrayList<Map<String,String>>();
		addmap(list, "日期", map.get("date"));
		addmap(list, "地点", map.get("area"));
		addmap(list, "描述", map.get("act"));
		addmap(list, "扣分", map.get("fen"));
		addmap(list, "罚款", map.get("money"));
		addmap(list, "处理状态", map.get("handled"));
		
		//加载适配器
		SimpleAdapter adapter = new SimpleAdapter(context, list, R.layout.item_result_detail,
				new String[]{"name","value"}, 
				new int[]{R.id.tv_name,R.id.tv_value});
		
		listView.setAdapter(adapter);
	}
	
	
	private void addmap(List<Map<String, String>> list,String nameStr,String valueStr){
		Map<String,String> map = new HashMap<String, String>();
		map.put("name", nameStr);
		map.put("value", valueStr);
		list.add(map);
	}
}
